﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace Tomato.Cryptography
{
    public class HashConversion
    {
        public HashConversion(HashAlgorithm algorithm)
        {
            this.algorithm = algorithm;
        }

        HashAlgorithm algorithm;

        public byte[] ComputeHash(byte[] data)
        {
            return algorithm.ComputeHash(data, 0, data.Length);
        }

        public byte[] ComputeHash(string s)
        {
            return ComputeHash(System.Text.Encoding.UTF8.GetBytes(s));
        }
    }
}
